package com.yifeng.nettyserver.netty;

import com.sun.org.apache.bcel.internal.generic.NEW;
import io.netty.channel.Channel;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * ClassName: NettyHolder
 * author: yifeng
 * date: 2020/6/5 16:10
 */
public class NettyHolder {

    public static final Map<Integer, Channel> CHANNELS= new ConcurrentHashMap();

    public static void put(Integer id,Channel channel){
        CHANNELS.put(id,channel);
    }

    public static Channel get(Integer id){
        return CHANNELS.get(id);
    }

    public static Map<Integer, Channel> getAll(){
        return CHANNELS;
    }

    public static void remove(Integer id){
        CHANNELS.remove(id);
    }
}
